Skip to content

fix(cli): reject model column collisions before scaffolding - #1051

Merged
cpojer merged 1 commit into
voidzero-dev:mainfrom
niteshseram:fix/model-gen-column-collisions
Dec 6, 2026
Merged

cpojer merged 1 commit into
voidzero-dev:mainfrom
niteshseram:fix/model-gen-column-collisions

Conversation

@niteshseram

Copy link
Copy Markdown
Contributor

Summary

void gen model posts title:string title:text reports success and generates duplicate title properties in the schema and API route. A single input can also collide with a column Void adds. id:integer overrides the generated primary key, and created_at:text or updated_at:text duplicates a SQL column.

Reject repeated and reserved column names before writing any files. The parser and schema templates share the generated column definitions across D1, PostgreSQL, and MySQL. For a reserved name, the error names the exact argument to remove, such as Void adds 'created_at' automatically. Remove 'created_at:text'.

Tests

  • gen-model-cli.test.ts runs the CLI with a repeated title and with each of the three reserved names. All four cases exit with code 1, print the expected error, and leave the project directory untouched

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks for the fix.

@cpojer
cpojer merged commit cb85598 into voidzero-dev:main Dec 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants